1. Field
This disclosure relates to monitoring scopes in a runtime environment. More specifically, the disclosure relates to a generic process that monitors dynamic scopes over synchronous and asynchronous invocations.
2. General Background
In computer programming, a scope is an enclosing context where values and expressions are associated. Various programming languages have various types of scopes. The type of scope determines what kind of entities the programming language can contain and how it affects those entities or semantics. For example, scopes can contain declarations or definitions of identifiers. Scopes can contain statements and/or expressions which define an executable algorithm or part thereof. Scopes can further nest or be nested. Variables, functions, and classes can all have scopes.
One of the basic reasons for scoping is to keep variables in different parts of a program distinct from one another. Since there are only a small number of short variable names, and programmers share habits about the naming of variables (e.g., “i” for an array index), in any program of moderate size the same variable name will be used in multiple different scopes. The question of how to match various variable occurrences to the appropriate binding sites is generally answered in one of two ways: static scoping and dynamic scoping.
With static scope, a variable always refers to its nearest enclosing binding site. This is a property of the program text and unrelated to the runtime call stack. Because matching a variable to its binding only requires analysis of the program text, this type of scoping is sometimes also called lexical scoping.
With dynamic scope, each identifier has a global stack of bindings. Introducing a local variable with name x pushes a binding onto the global x stack (which may have been empty), which is popped off when the control flow leaves the scope. Evaluating x in any context always yields the top binding. In other words, a global identifier refers to the identifier associated with the most recent environment. This cannot be completed at compile time because the binding stack only exists at runtime, which is why this type of scoping is called dynamic scoping.
A widely known dynamic scope mechanism is found in the Java 2 Platform Enterprise Edition (“J2EE”), in which a target component upon invocation can join, leave, or suspend the existing scope. However, this scope mechanism, along with the corresponding implementation, is limited to synchronous invocations only.
Business Integration (BI) software products, such as the IBM CrossWorlds system and WebSphere Business Integration (WBI) system, provide mechanisms for two or more third party products to communicate and collaborate with each other. The WBI component model encapsulates both synchronous and asynchronous invocations into a unified model. However there is currently no method of tracking dynamic scopes in a component model which applies to both synchronous and asynchronous invocations.